/**
	Copyright (c) 2009 Ozazo Pvt Ltd, INDIA

	Permission is hereby granted, free of charge, to any person or organization 
	obtaining a copy of this software and associated  documentation  files (the 
	"Software"), to deal in the Software without restriction, including without 
	limitation the rights to use, copy, modify, merge, publish, distribute, sub
	license, and/or sell copies of the Software, and to permit persons  to whom 
	the Software is furnished to do so, subject to the following conditions:
	
	The above copyright notice and  this permission notice shall be included in 
	all copies or substantial portions of the Software.
	
	THE SOFTWARE IS PROVIDED "AS IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING  BUT NOT  LIMITED  TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR  COPYRIGHT  HOLDERS  BE  LIABLE  FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY,  WHETHER  IN  AN  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
	FROM,  OUT  OF  OR  IN  CONNECTION  WITH  THE  SOFTWARE OR THE USE OR OTHER 
	DEALINGS IN THE SOFTWARE.
 */
package com.ozazo.wave.robots.fw.config;

/**
 * ContainerConfig.java
 *
 * @author:  Araf Karsh Hamid
 * @date:    
 * @serial:  20091129173023
 * @version: 1.0
 *
 */
public class RobotDetails {

	private final boolean isEnabled;	
	private final String name;
	private final String profileName;
	private final String iconName;

	public RobotDetails() {
		this("ROBOT_NAME_NOT_DEFINED", "PROFILE_NAME_NOT_DEFINED", "ICON_NOT_DEFINED");
	}
		
	public RobotDetails(final String _name, final String _profile, final String _iconName) {
		isEnabled = true;
		name		= (_name != null)  ? _name : "ROBOT_NAME_NOT_DEFINED";
		profileName	= (_profile != null) ? _profile : "PROFILE_NAME_NOT_DEFINED";
		iconName	= (_iconName != null) ? _iconName : "ICON_NOT_DEFINED";
	}
	
	public boolean isEnabled() {
		return isEnabled;
	}
	
	public String getName() {
		return name;
	}
	
	public String getProfileName() {
		return profileName;
	}
	
	public String getIconName() {
		return iconName;
	}
	
	public String toString() {
		return name;
	}
	
	public int hashCode() {
		return name.hashCode();
	}
	
	public boolean equals(Object o) {
		try {
			RobotDetails e = (RobotDetails)o;
			return e.getName().equals(this.getName()) ? true : false;
		} catch (Exception ignored) {}
		return false;
	}
	
	public String toXMLString() {
		StringBuilder sb = new StringBuilder();
		/**
		<RobotDetails>
			<robotName>OzoBuddyRobo</robotName>
			<robotProfile></robotProfile>
			<robotIcon></robotIcon>
		</RobotDetails>	
		*/
		sb.append("\t<RobotDetails>\n");
		sb.append("\t\t<robotName>").append(name).append("</robotName>\n");
		sb.append("\t\t<robotProfile>").append(profileName).append("</robotProfile>\n");
		sb.append("\t\t<robotIcon>").append(iconName).append("</robotIcon>\n");
		sb.append("\t</RobotDetails>\n");
		return sb.toString();
	}
}
